<template>
  <div v-if="chooseParams!=null">

    <span v-for="(x,index) in chooseParams"   :key="index">
      <span v-if="x.show==null">
        <span  v-if="x.type==2">
          <span v-for="(y,key) in x.filter" :key="key">
            <el-tag @close="handleClose(y)"  v-if="y.state==1&&y.params.value!=''" size="small" style="margin-right:4px;" closable type="danger">{{y.label+" "+y.alias+" `"+y.params.value+"`"}}</el-tag>
          </span>
        </span>
        <el-tag v-else-if="x.type==1&&x.state==1&&x.params.value!=''" @close="handleClose(x)" type="danger" closable style="margin-right:4px;" size="small" >{{x.label+" "+x.alias+" `"+x.params.value+"`"}}</el-tag>
        <el-tag v-else-if="x.type==3&&x.state==1&&x.params.value!=''" @close="handleClose(x)" type="danger" closable style="margin-right:4px;" size="small" >{{x.label+" `"+x.alias+"`"}}</el-tag>
        <el-tag v-if="x.orderBy.state==1&&x.orderBy.value!=''" type="primary" closable  @close="handleCloseOrderBy(x)" size="small">{{x.label+" `"+(x.orderBy.value=='desc'?'降序':'升序')+"`排序"}}</el-tag>
      </span>
    </span>
  </div>
</template>
<script>
  export default {
    name: "template_tag_search",
    data() {
      return {
      }
    },
    props: ['chooseParams'],
    methods:{
      toSearch(){
        this.$emit("toSearchFilter");
      },
      handleClose(param) {
          if(param.type==3){
              param.params.value="";
          }else {
            param.params.value="";
            param.params.condition=param.conditions.options[0].opt;
          }
          this.toSearch();
      },
      handleCloseOrderBy(param) {
          param.orderBy.value="";
          this.toSearch();
      }
    },
    updated(){
    }
  }
</script>
<style scoped>
</style>
